﻿@model SimpleTaskManager.Domain.Entities.User
@using SimpleTaskManager.Domain.Entities;

<table>
    <thead>
        <tr>
            <th>Date</th>
            <th>Hours</th>
            <th>Task</th>
            @if(ViewBag.DisplayEdit){<th></th>}
        </tr>
    </thead>
    <tbody>
        @foreach(WorkingHoursEntry myHours in Model.WorkingHoursEntries) {
            <tr>
                <td>@myHours.Date.ToString("yyyy-MM-dd")</td>
                <td>@myHours.Hours</td>
                <td>@myHours.Task.Name @if (myHours.Task.Description != null) {@myHours.Task.Description}</td>
                @if(ViewBag.DisplayEdit){
                    <td>@Html.ActionLink("Delete", "DeleteHours", new { id = myHours.WorkingHoursEntryID })</td>
                    }
            </tr>
        }
    </tbody>
</table>

<script>
    $(document).ready(function () {
        $("tr td a:contains('Delete')").click(function () {
            if (confirm("Are you sure you want to delete this?")) {
                return true;
            } else {
                return false;
            }
        });
    });
</script>